home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / PInterfaces / Processes.p < prev    next >
Text File  |  1996-05-01  |  7KB  |  254 lines

  1. {
  2.      File:        Processes.p
  3.  
  4.      Contains:    Process Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT Processes;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __PROCESSES__}
  28. {$SETC __PROCESSES__ := 1}
  29.  
  30. {$I+}
  31. {$SETC ProcessesIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __TYPES__}
  35. {$I Types.p}
  36. {$ENDC}
  37. {$IFC UNDEFINED __EVENTS__}
  38. {$I Events.p}
  39. {$ENDC}
  40. {$IFC UNDEFINED __FILES__}
  41. {$I Files.p}
  42. {$ENDC}
  43. {$IFC FOR_SYSTEM8_PREEMPTIVE }
  44. {$IFC UNDEFINED __KERNEL__}
  45. {$I Kernel.p}
  46. {$ENDC}
  47. {$IFC UNDEFINED __FILEMANAGERTYPES__}
  48. {$I FileManagerTypes.p}
  49. {$ENDC}
  50. {$ENDC}
  51.  
  52. {$PUSH}
  53. {$ALIGN MAC68K}
  54. {$LibExport+}
  55.  
  56. {  type for unique process identifier  }
  57.  
  58. TYPE
  59.     ProcessSerialNumberPtr = ^ProcessSerialNumber;
  60.     ProcessSerialNumber = RECORD
  61.         highLongOfPSN:            LONGINT;
  62.         lowLongOfPSN:            LONGINT;
  63.     END;
  64.  
  65.  
  66. CONST
  67.                                                                 {  Process identifier - Various reserved process serial numbers  }
  68.     kNoProcess                    = 0;
  69.     kSystemProcess                = 1;
  70.     kCurrentProcess                = 2;
  71.  
  72. {$IFC FOR_SYSTEM8_PREEMPTIVE }
  73.                                                                 {  supported versions for GetApplicationInformation }
  74.     kApplicationInformationVersion = 1;
  75.  
  76.  
  77. TYPE
  78.     ApplicationInformationPtr = ^ApplicationInformation;
  79.     ApplicationInformation = RECORD
  80.         primaryTaskID:            TaskID;
  81.         applicationLauncher:    KernelProcessID;
  82.         applicationFile:        FSObjectRef;
  83.     END;
  84.  
  85. FUNCTION GetApplicationInformation(theProcessID: KernelProcessID; version: PBVersion; VAR appInfo: ApplicationInformation): OSStatus; C;
  86.  
  87. CONST
  88.                                                                 {  supported versions for LaunchInformation structure }
  89.     kLaunchInformationVersion    = 1;
  90.  
  91.  
  92. TYPE
  93.     LaunchInformationPtr = ^LaunchInformation;
  94.     LaunchInformation = RECORD
  95.         kernelProcessID:        KernelProcessID;
  96.     END;
  97.  
  98. {  for now, the launch call only supports an application in the FSObjectSpecification }
  99. FUNCTION Launch(theFSObjectRef: FSObjectRef; version: PBVersion; VAR launchInfo: LaunchInformation): OSStatus; C;
  100. FUNCTION GetKernelProcessIDFromPSN({CONST}VAR PSN: ProcessSerialNumber; VAR kernelProcessID: KernelProcessID): OSStatus; C;
  101. FUNCTION GetPSNFromKernelProcessID(kernelProcessID: KernelProcessID; VAR PSN: ProcessSerialNumber): OSStatus; C;
  102. {$ENDC}
  103. {  Definition of the parameter block passed to _Launch  }
  104. {
  105.  Typedef and flags for launchControlFlags field
  106.  #if FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED??
  107. }
  108.  
  109. TYPE
  110.     LaunchFlags                            = INTEGER;
  111.  
  112. CONST
  113.     launchContinue                = $4000;
  114.     launchNoFileFlags            = $0800;
  115.     launchUseMinimum            = $0400;
  116.     launchDontSwitch            = $0200;
  117.     launchAllow24Bit            = $0100;
  118.     launchInhibitDaemon            = $0080;
  119.  
  120. {
  121.  Format for first AppleEvent to pass to new process.  The size of the overall
  122.   buffer variable: the message body immediately follows the messageLength 
  123. }
  124.  
  125. TYPE
  126.     AppParametersPtr = ^AppParameters;
  127.     AppParameters = RECORD
  128.         theMsgEvent:            EventRecord;
  129.         eventRefCon:            LONGINT;
  130.         messageLength:            LONGINT;
  131.     END;
  132.  
  133. {  Parameter block to _Launch  }
  134.     LaunchParamBlockRecPtr = ^LaunchParamBlockRec;
  135.     LaunchParamBlockRec = RECORD
  136.         reserved1:                LONGINT;
  137.         reserved2:                INTEGER;
  138.         launchBlockID:            INTEGER;
  139.         launchEPBLength:        LONGINT;
  140.         launchFileFlags:        INTEGER;
  141.         launchControlFlags:        LaunchFlags;
  142.         launchAppSpec:            FSSpecPtr;
  143.         launchProcessSN:        ProcessSerialNumber;
  144.         launchPreferredSize:    LONGINT;
  145.         launchMinimumSize:        LONGINT;
  146.         launchAvailableSize:    LONGINT;
  147.         launchAppParameters:    AppParametersPtr;
  148.     END;
  149.  
  150.     LaunchPBPtr                            = ^LaunchParamBlockRec;
  151. {
  152.  Set launchBlockID to extendedBlock to specify that extensions exist.
  153.  Set launchEPBLength to extendedBlockLen for compatibility.
  154. }
  155.  
  156. CONST
  157.     extendedBlock                = $4C43;                        {  'LC'  }
  158.     extendedBlockLen            = 32;
  159.  
  160.                                                                 {  Definition of the information block returned by GetProcessInformation  }
  161.     modeLaunchDontSwitch        = $00040000;
  162.     modeDeskAccessory            = $00020000;
  163.     modeMultiLaunch                = $00010000;
  164.     modeNeedSuspendResume        = $00004000;
  165.     modeCanBackground            = $00001000;
  166.     modeDoesActivateOnFGSwitch    = $00000800;
  167.     modeOnlyBackground            = $00000400;
  168.     modeGetFrontClicks            = $00000200;
  169.     modeGetAppDiedMsg            = $00000100;
  170.     mode32BitCompatible            = $00000080;
  171.     modeHighLevelEventAware        = $00000040;
  172.     modeLocalAndRemoteHLEvents    = $00000020;
  173.     modeStationeryAware            = $00000010;
  174.     modeUseTextEditServices        = $00000008;
  175.     modeDisplayManagerAware        = $00000004;
  176.  
  177. {  Record returned by GetProcessInformation  }
  178.  
  179. TYPE
  180.     ProcessInfoRecPtr = ^ProcessInfoRec;
  181.     ProcessInfoRec = RECORD
  182.         processInfoLength:        LONGINT;
  183.         processName:            StringPtr;
  184.         processNumber:            ProcessSerialNumber;
  185.         processType:            LONGINT;
  186.         processSignature:        OSType;
  187.         processMode:            LONGINT;
  188.         processLocation:        Ptr;
  189.         processSize:            LONGINT;
  190.         processFreeMem:            LONGINT;
  191.         processLauncher:        ProcessSerialNumber;
  192.         processLaunchDate:        LONGINT;
  193.         processActiveTime:        LONGINT;
  194.         processAppSpec:            FSSpecPtr;
  195.     END;
  196.  
  197. {  #endif // FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED?? }
  198. {$IFC FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED }
  199. FUNCTION LaunchApplication(LaunchParams: LaunchPBPtr): OSErr;
  200.     {$IFC NOT GENERATINGCFM}
  201.     INLINE $205F, $A9F2, $3E80;
  202.     {$ENDC}
  203. FUNCTION LaunchDeskAccessory({CONST}VAR pFileSpec: FSSpec; pDAName: Str255): OSErr;
  204.     {$IFC NOT GENERATINGCFM}
  205.     INLINE $3F3C, $0036, $A88F;
  206.     {$ENDC}
  207. FUNCTION GetCurrentProcess(VAR PSN: ProcessSerialNumber): OSErr;
  208.     {$IFC NOT GENERATINGCFM}
  209.     INLINE $3F3C, $0037, $A88F;
  210.     {$ENDC}
  211. FUNCTION GetFrontProcess(VAR PSN: ProcessSerialNumber): OSErr;
  212.     {$IFC NOT GENERATINGCFM}
  213.     INLINE $70FF, $2F00, $3F3C, $0039, $A88F;
  214.     {$ENDC}
  215. FUNCTION GetNextProcess(VAR PSN: ProcessSerialNumber): OSErr;
  216.     {$IFC NOT GENERATINGCFM}
  217.     INLINE $3F3C, $0038, $A88F;
  218.     {$ENDC}
  219. FUNCTION GetProcessInformation({CONST}VAR PSN: ProcessSerialNumber; VAR info: ProcessInfoRec): OSErr;
  220.     {$IFC NOT GENERATINGCFM}
  221.     INLINE $3F3C, $003A, $A88F;
  222.     {$ENDC}
  223. FUNCTION SetFrontProcess({CONST}VAR PSN: ProcessSerialNumber): OSErr;
  224.     {$IFC NOT GENERATINGCFM}
  225.     INLINE $3F3C, $003B, $A88F;
  226.     {$ENDC}
  227. FUNCTION WakeUpProcess({CONST}VAR PSN: ProcessSerialNumber): OSErr;
  228.     {$IFC NOT GENERATINGCFM}
  229.     INLINE $3F3C, $003C, $A88F;
  230.     {$ENDC}
  231. FUNCTION SameProcess({CONST}VAR PSN1: ProcessSerialNumber; {CONST}VAR PSN2: ProcessSerialNumber; VAR result: BOOLEAN): OSErr;
  232.     {$IFC NOT GENERATINGCFM}
  233.     INLINE $3F3C, $003D, $A88F;
  234.     {$ENDC}
  235. {$ENDC}
  236. {$IFC FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE }
  237. {$IFC NOT OLDROUTINELOCATIONS }
  238. PROCEDURE ExitToShell;
  239.     {$IFC NOT GENERATINGCFM}
  240.     INLINE $A9F4;
  241.     {$ENDC}
  242. {$ENDC}
  243. {$ENDC}
  244. {$ALIGN RESET}
  245. {$POP}
  246.  
  247. {$SETC UsingIncludes := ProcessesIncludes}
  248.  
  249. {$ENDC} {__PROCESSES__}
  250.  
  251. {$IFC NOT UsingIncludes}
  252.  END.
  253. {$ENDC}
  254.